#include <stdio.h>
#include <math.h>

int main() {
    char c[18];
    int xishu[17] = {7, 9, 10,5,8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2};
    char jieguo[11] = {'1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'};
    int i, sum = 0;
    scanf("%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c", 
        &c[0],&c[1],&c[2],&c[3],&c[4],&c[5],&c[6],&c[7],&c[8],&c[9],&c[10],&c[11],&c[12],&c[13],&c[14],&c[15],&c[16]);
    for (i=0; i<17; ++i) {
        sum = sum + (c[i] - '0') * xishu[i];
    }
    printf("%c", jieguo[sum % 11]);

    return 0;
}
